package org.west.sky.frame.activiti.study.chapter17.demo0103;

import org.activiti.engine.delegate.BpmnError;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;

/**
 * author: chz
 * date: 2025/8/1
 * description: 扣除库存
 */
public class DeductSkuDelegate implements JavaDelegate {


    private int sku = 5;

    @Override
    public void execute(DelegateExecution execution) {
        int itemNum = Integer.parseInt(execution.getVariable("itemNum").toString());
        if(itemNum > sku){
            throw new BpmnError("noSku");
        }
        System.out.println("====库存扣除成功");
    }
}
